package org.changneng.framework.frameworkbusiness.service.impl;

import org.changneng.framework.frameworkbusiness.dao.UsersMapper;
import org.changneng.framework.frameworkbusiness.entity.Users;
import org.changneng.framework.frameworkbusiness.entity.UsersExample;
import org.changneng.framework.frameworkbusiness.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UsersServiceImpl implements UsersService {

    @Autowired
    private UsersMapper usersMapper;

    @Override
    public int insert(Users users) {
        return usersMapper.insert(users);
    }

    @Override
    public Users select(Users users) {

        UsersExample example = new UsersExample();
        example.createCriteria().andBidEqualTo(users.getBid()).andPassWordEqualTo(users.getPassWord());
        List<Users> users1 = usersMapper.selectByExample(example);

        return users1.get(0);
    }
}
